﻿using System;
using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Interop.Outlook;
using System.Runtime.InteropServices;


namespace OutlookMessageWrapper
{
    /// <summary>
    /// Wrapper class for Outlook Appointment item
    /// </summary>
    class OutlookAppointmentItem : OutlookMessageItemWrapper
    {
        public Outlook.AppointmentItem Item { get; set; }

        public OutlookAppointmentItem(Outlook.AppointmentItem olAppointment)
        {
            Item = olAppointment;

            RegisterEvents();
        }

        /// <summary>
        /// Registers all outlook item events
        /// </summary>
        private void RegisterEvents()
        {
            Item.AfterWrite += new ItemEvents_10_AfterWriteEventHandler(Item_AfterWrite);
            Item.AttachmentAdd += new ItemEvents_10_AttachmentAddEventHandler(Item_AttachmentAdd);
            Item.AttachmentRead += new ItemEvents_10_AttachmentReadEventHandler(Item_AttachmentRead);
            Item.AttachmentRemove += new ItemEvents_10_AttachmentRemoveEventHandler(Item_AttachmentRemove);
            Item.BeforeAttachmentAdd += new ItemEvents_10_BeforeAttachmentAddEventHandler(Item_BeforeAttachmentAdd);
            Item.BeforeAttachmentPreview += new ItemEvents_10_BeforeAttachmentPreviewEventHandler(Item_BeforeAttachmentPreview);
            Item.BeforeAttachmentRead += new ItemEvents_10_BeforeAttachmentReadEventHandler(Item_BeforeAttachmentRead);
            Item.BeforeAttachmentSave += new ItemEvents_10_BeforeAttachmentSaveEventHandler(Item_BeforeAttachmentSave);
            Item.BeforeAttachmentWriteToTempFile += new ItemEvents_10_BeforeAttachmentWriteToTempFileEventHandler(Item_BeforeAttachmentWriteToTempFile);
            Item.BeforeAutoSave += new ItemEvents_10_BeforeAutoSaveEventHandler(Item_BeforeAutoSave);
            Item.BeforeCheckNames += new ItemEvents_10_BeforeCheckNamesEventHandler(Item_BeforeCheckNames);
            Item.BeforeDelete += new ItemEvents_10_BeforeDeleteEventHandler(Item_BeforeDelete);
            Item.BeforeRead += new ItemEvents_10_BeforeReadEventHandler(Item_BeforeRead);
            Item.CustomAction += new ItemEvents_10_CustomActionEventHandler(Item_CustomAction);
            Item.CustomPropertyChange += new ItemEvents_10_CustomPropertyChangeEventHandler(Item_CustomPropertyChange);
            Item.Open += new ItemEvents_10_OpenEventHandler(Item_Open);
            Item.PropertyChange += new ItemEvents_10_PropertyChangeEventHandler(Item_PropertyChange);
            Item.Read += new ItemEvents_10_ReadEventHandler(Item_Read);
            Item.Unload += new ItemEvents_10_UnloadEventHandler(Item_Unload);
            Item.Write += new ItemEvents_10_WriteEventHandler(Item_Write);
            Item.Forward += new ItemEvents_10_ForwardEventHandler(Item_Forward);
            Item.Reply += new ItemEvents_10_ReplyEventHandler(Item_Reply);
            Item.ReplyAll += new ItemEvents_10_ReplyAllEventHandler(Item_ReplyAll);
        }

        /// <summary>
        /// Un-registers all outlook item events
        /// </summary>
        private void UnRegisterEvents()
        {
            Item.AfterWrite -= new ItemEvents_10_AfterWriteEventHandler(Item_AfterWrite);
            Item.AttachmentAdd -= new ItemEvents_10_AttachmentAddEventHandler(Item_AttachmentAdd);
            Item.AttachmentRead -= new ItemEvents_10_AttachmentReadEventHandler(Item_AttachmentRead);
            Item.AttachmentRemove -= new ItemEvents_10_AttachmentRemoveEventHandler(Item_AttachmentRemove);
            Item.BeforeAttachmentAdd -= new ItemEvents_10_BeforeAttachmentAddEventHandler(Item_BeforeAttachmentAdd);
            Item.BeforeAttachmentPreview -= new ItemEvents_10_BeforeAttachmentPreviewEventHandler(Item_BeforeAttachmentPreview);
            Item.BeforeAttachmentRead -= new ItemEvents_10_BeforeAttachmentReadEventHandler(Item_BeforeAttachmentRead);
            Item.BeforeAttachmentSave -= new ItemEvents_10_BeforeAttachmentSaveEventHandler(Item_BeforeAttachmentSave);
            Item.BeforeAttachmentWriteToTempFile -= new ItemEvents_10_BeforeAttachmentWriteToTempFileEventHandler(Item_BeforeAttachmentWriteToTempFile);
            Item.BeforeAutoSave -= new ItemEvents_10_BeforeAutoSaveEventHandler(Item_BeforeAutoSave);
            Item.BeforeCheckNames -= new ItemEvents_10_BeforeCheckNamesEventHandler(Item_BeforeCheckNames);
            Item.BeforeDelete -= new ItemEvents_10_BeforeDeleteEventHandler(Item_BeforeDelete);
            Item.BeforeRead -= new ItemEvents_10_BeforeReadEventHandler(Item_BeforeRead);
            Item.CustomAction -= new ItemEvents_10_CustomActionEventHandler(Item_CustomAction);
            Item.CustomPropertyChange -= new ItemEvents_10_CustomPropertyChangeEventHandler(Item_CustomPropertyChange);
            Item.Open -= new ItemEvents_10_OpenEventHandler(Item_Open);
            Item.PropertyChange -= new ItemEvents_10_PropertyChangeEventHandler(Item_PropertyChange);
            Item.Read -= new ItemEvents_10_ReadEventHandler(Item_Read);
            Item.Unload -= new ItemEvents_10_UnloadEventHandler(Item_Unload);
            Item.Write -= new ItemEvents_10_WriteEventHandler(Item_Write);
            Item.Forward -= new ItemEvents_10_ForwardEventHandler(Item_Forward);
            Item.Reply -= new ItemEvents_10_ReplyEventHandler(Item_Reply);
            Item.ReplyAll -= new ItemEvents_10_ReplyAllEventHandler(Item_ReplyAll);
        }

        void Item_ReplyAll(object Response, ref bool Cancel)
        {
            if (ReplyAllItem != null)
            {
                ReplyAllItem(Response, ref Cancel);
            }
        }

        void Item_Reply(object Response, ref bool Cancel)
        {
            if (ReplyItem != null)
            {
                ReplyItem(Response, ref Cancel);
            }
        }

        void Item_Forward(object Forward, ref bool Cancel)
        {
            if (ForwardItem != null)
            {
                ForwardItem(Forward, ref Cancel);
            }
        }

        void Item_Write(ref bool Cancel)
        {
            if (Write != null)
            {
                Write(ref Cancel);
            }
        }

        void Item_Unload()
        {
            if (Unload != null)
            {
                Unload();
            }
        }

        void Item_Read()
        {
            if (Read != null)
            {
                Read();
            }
        }

        void Item_PropertyChange(string Name)
        {
            if (PropertyChange != null)
            {
                PropertyChange(Name);
            }
        }

        void Item_Open(ref bool Cancel)
        {
            if (Open != null)
            {
                Open(ref Cancel);
            }
        }

        void Item_CustomPropertyChange(string Name)
        {
            if (CustomPropertyChange != null)
            {
                CustomPropertyChange(Name);
            }
        }

        void Item_CustomAction(object Action, object Response, ref bool Cancel)
        {
            if (CustomAction != null)
            {
                CustomAction(Action, Response, ref Cancel);
            }
        }

        void Item_BeforeRead()
        {
            if (BeforeRead != null)
            {
                BeforeRead();
            }
        }

        void Item_BeforeDelete(object Item, ref bool Cancel)
        {
            if (BeforeDelete != null)
            {
                BeforeDelete(Item, ref Cancel);
            }
        }

        void Item_BeforeCheckNames(ref bool Cancel)
        {
            if (BeforeCheckNames != null)
            {
                BeforeCheckNames(ref Cancel);
            }
        }

        void Item_BeforeAutoSave(ref bool Cancel)
        {
            if (BeforeAutoSave != null)
            {
                BeforeAutoSave(ref Cancel);
            }
        }

        void Item_BeforeAttachmentWriteToTempFile(Attachment Attachment, ref bool Cancel)
        {
            if (BeforeAttachmentWriteToTempFile != null)
            {
                BeforeAttachmentWriteToTempFile(Attachment, ref Cancel);
            }
        }

        void Item_BeforeAttachmentSave(Attachment Attachment, ref bool Cancel)
        {
            if (BeforeAttachmentSave != null)
            {
                BeforeAttachmentSave(Attachment, ref Cancel);
            }
        }

        void Item_BeforeAttachmentRead(Attachment Attachment, ref bool Cancel)
        {
            if (BeforeAttachmentRead != null)
            {
                BeforeAttachmentRead(Attachment, ref Cancel);
            }
        }

        void Item_BeforeAttachmentPreview(Attachment Attachment, ref bool Cancel)
        {
            if (BeforeAttachmentPreview != null)
            {
                BeforeAttachmentPreview(Attachment, ref Cancel);
            }
        }

        void Item_BeforeAttachmentAdd(Attachment Attachment, ref bool Cancel)
        {
            if (BeforeAttachmentAdd != null)
            {
                BeforeAttachmentAdd(Attachment, ref Cancel);
            }
        }

        void Item_AttachmentRemove(Attachment Attachment)
        {
            if (AttachmentRemove != null)
            {
                AttachmentRemove(Attachment);
            }
        }

        void Item_AttachmentRead(Attachment Attachment)
        {
            if (AttachmentRead != null)
            {
                AttachmentRead(Attachment);
            }
        }

        void Item_AttachmentAdd(Attachment Attachment)
        {
            if (AttachmentAdd != null)
            {
                AttachmentAdd(Attachment);
            }
        }

        void Item_AfterWrite()
        {
            if (AfterWrite != null)
            {
                AfterWrite();
            }
        }

        public override string Subject
        {
            get
            {
                return Item.Subject;
            }
            set
            {
                Item.Subject = value;
            }
        }

        public override string EntryID
        {
            get
            {
                return Item.EntryID;
            }
        }

        public override string MessageClass
        {
            get
            {
                return Item.MessageClass;
            }
            set
            {
                Item.MessageClass = value;
            }
        }

        public override string OutlookVersion
        {
            get
            {
                return Item.OutlookVersion;
            }
        }

        public override string Body
        {
            get
            {
                return Item.Body;
            }
            set
            {
                Item.Body = value;
            }
        }

        public override int Size
        {
            get { return Item.Size; }
        }

        public override DateTime CreationTime
        {
            get { return Item.CreationTime; }
        }

        public override DateTime LastModificationTime
        {
            get { return Item.LastModificationTime; }
        }

        public override Application Application
        {
            get { return Item.Application; }
        }

        #region override function & properties

        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.Actions collection that represents
        ///     all the available actions for the item. Read-only.
        ///</summary>
        public override Actions Actions { get { return Item.Actions; } }

        ///<summary>
        ///     Returns True if the appointment is an all-day event (as opposed to a specified
        ///     time). Read/write.
        ///</summary>
        public override bool AllDayEvent { get { return Item.AllDayEvent; } set { Item.AllDayEvent = value; } }

        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.Attachments object that represents
        ///     all the attachments for the specified item. Read-only.
        ///</summary>

        public override Attachments Attachments { get { return Item.Attachments; } }
        ///<summary>
        ///     Returns a Boolean (bool in C#) that determines if the item is a winner of
        ///     an automatic conflict resolution. Read-only.
        ///</summary>

        public override bool AutoResolvedWinner { get { return Item.AutoResolvedWinner; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the billing information
        ///     associated with the Outlook item. Read/write.
        ///</summary>

        public override string BillingInformation { get { return Item.BillingInformation; } set { Item.BillingInformation = value; } }
        ///<summary>
        ///     Returns or sets an Microsoft.Office.Interop.Outlook.OlBusyStatus constant
        ///     indicating the busy status of the user for the appointment. Read/write.
        ///</summary>

        public override OlBusyStatus BusyStatus { get { return Item.BusyStatus; } set { Item.BusyStatus = value; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the categories assigned
        ///     to the Outlook item. Read/write.
        ///</summary>

        public override string Categories { get { return Item.Categories; } set { Item.Categories = value; } }
        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.OlObjectClass constant indicating
        ///     the object's class. Read-only.
        ///</summary>

        public override OlObjectClass Class { get { return Item.Class; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the names of the companies
        ///     associated with the Outlook item. Read/write.
        ///</summary>

        public override string Companies { get { return Item.Companies; } set { Item.Companies = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override bool ConferenceServerAllowExternal { get { return Item.ConferenceServerAllowExternal; } set { Item.ConferenceServerAllowExternal = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override string ConferenceServerPassword { get { return Item.ConferenceServerPassword; } set { Item.ConferenceServerPassword = value; } }
        ///<summary>
        ///     Return the Microsoft.Office.Interop.Outlook.Conflicts object that represents
        ///     the items that are in conflict for any Outlook item object. Read-only.
        ///</summary>

        public override Conflicts Conflicts { get { return Item.Conflicts; } }
        ///<summary>
        ///     Returns a String (string in C#) that uniquely identifies a Microsoft.Office.Interop.Outlook.Conversation
        ///     object that the Microsoft.Office.Interop.Outlook.AppointmentItem object belongs
        ///     to. Read-only.
        ///</summary>

        public override string ConversationID { get { return Item.ConversationID; } }
        ///<summary>
        ///     Returns a String (string in C#) representing the index of the conversation
        ///     thread of the Outlook item. Read-only.
        ///</summary>

        public override string ConversationIndex { get { return Item.ConversationIndex; } }
        ///<summary>
        ///     Returns a String (string in C#) representing the topic of the conversation
        ///     thread of the Outlook item. Read-only.
        ///</summary>

        public override string ConversationTopic { get { return Item.ConversationTopic; } }
        ///<summary>
        ///     Returns a constant that belongs to the Microsoft.Office.Interop.Outlook.OlDownloadState
        ///     enumeration indicating the download state of the item. Read-only.
        ///</summary>

        public override OlDownloadState DownloadState { get { return Item.DownloadState; } }
        ///<summary>
        ///     Returns or sets an Integer (int in C#) value indicating the duration (in
        ///     minutes) of the Microsoft.Office.Interop.Outlook.AppointmentItem. Read/write.
        ///</summary>

        public override int Duration { get { return Item.Duration; } set { Item.Duration = value; } }
        ///<summary>
        ///     Returns or sets a DateTime indicating the end date and time of an Microsoft.Office.Interop.Outlook.AppointmentItem.
        ///     Read/write.
        ///</summary>

        public override DateTime End { get { return Item.End; } set { Item.End = value; } }
        ///<summary>
        ///     Returns or sets a DateTime value that represents the end date and time of
        ///     the appointment expressed in the Microsoft.Office.Interop.Outlook._AppointmentItem.EndTimeZone.
        ///     Read/write.
        ///</summary>

        public override DateTime EndInEndTimeZone { get { return Item.EndInEndTimeZone; } set { Item.EndInEndTimeZone = value; } }
        ///<summary>
        ///     Returns or sets a Microsoft.Office.Interop.Outlook.TimeZone value that corresponds
        ///     to the end time of the appointment. Read/write.
        ///</summary>

        public override Outlook.TimeZone EndTimeZone { get { return Item.EndTimeZone; } set { Item.EndTimeZone = value; } }
        ///<summary>
        ///     Returns or sets a DateTime value that represents the end date and time of
        ///     the appointment expressed in the Coordinated Universal Time (UTC) standard.
        ///     Read/write.
        ///</summary>

        public override DateTime EndUTC { get { return Item.EndUTC; } set { Item.EndUTC = value; } }
        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that indicates whether updates
        ///     to the Microsoft.Office.Interop.Outlook.AppointmentItem object should be
        ///     sent to all attendees. Read/write.
        ///</summary>

        public override bool ForceUpdateToAllAttendees { get { return Item.ForceUpdateToAllAttendees; } set { Item.ForceUpdateToAllAttendees = value; } }
        ///<summary>
        ///     Returns the Microsoft.Office.Interop.Outlook.FormDescription object that
        ///     represents the form description for the specified Outlook item. Read-only.
        ///</summary>

        public override FormDescription FormDescription { get { return Item.FormDescription; } }
        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.Inspector object that represents
        ///     an inspector initialized to contain the specified item. Read-only.
        ///</summary>

        public override Inspector GetInspector { get { return Item.GetInspector; } }
        ///<summary>
        ///     Returns a String (string in C#) value that represents a unique global identifier
        ///     for the Microsoft.Office.Interop.Outlook.AppointmentItem object. Read-only.
        ///</summary>

        public override string GlobalAppointmentID { get { return Item.GlobalAppointmentID; } }
        ///<summary>
        ///     Returns or sets an Microsoft.Office.Interop.Outlook.OlImportance constant
        ///     indicating the relative importance level for the Outlook item. Read/write.
        ///</summary>

        public override OlImportance Importance { get { return Item.Importance; } set { Item.Importance = value; } }
        ///<summary>
        ///     Returns or sets an Integer (int in C#) value that determines the Internet
        ///     code page used by the item. Read/write.
        ///</summary>

        public override int InternetCodepage { get { return Item.InternetCodepage; } set { Item.InternetCodepage = value; } }
        ///<summary>
        ///     Returns a Boolean (bool in C#) that determines if the item on the local computer
        ///     is different from the copy on the server. Read-only.
        ///</summary>

        public override bool IsConflict { get { return Item.IsConflict; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override bool IsOnlineMeeting { get { return Item.IsOnlineMeeting; } set { Item.IsOnlineMeeting = value; } }
        ///<summary>
        ///     Returns a Boolean (bool in C#) value that is True if the appointment is a
        ///     recurring appointment. Read-only.
        ///</summary>

        public override bool IsRecurring { get { return Item.IsRecurring; } }
        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.ItemProperties collection that
        ///     represents all standard and user-defined properties associated with the Outlook
        ///     item. Read-only.
        ///</summary>

        public override ItemProperties ItemProperties { get { return Item.ItemProperties; } }
        ///<summary>
        ///     Returns a Microsoft.Office.Interop.Outlook.Links collection that represents
        ///     the contacts to which the item is linked. Read-only.
        ///</summary>

        public override Links Links { get { return Item.Links; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the specific office
        ///     location (for example, Building 1 Room 1 or Suite 123) for the appointment.
        ///     Read/write.
        ///</summary>

        public override string Location { get { return Item.Location; } set { Item.Location = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override dynamic MAPIOBJECT { get { return Item.MAPIOBJECT; } }
        ///<summary>
        ///     Returns or sets an Microsoft.Office.Interop.Outlook.OlRemoteStatus constant
        ///     that determines the status of an item once it is received by a remote user.
        ///     Read/write.
        ///</summary>

        public override OlRemoteStatus MarkForDownload { get { return Item.MarkForDownload; } set { Item.MarkForDownload = value; } }
        ///<summary>
        ///     Returns or sets an Microsoft.Office.Interop.Outlook.OlMeetingStatus constant
        ///     specifying the meeting status of the appointment. Read/write.
        ///</summary>

        public override OlMeetingStatus MeetingStatus { get { return Item.MeetingStatus; } set { Item.MeetingStatus = value; } }
        ///<summary>
        ///     Returns a String (string in C#) value that represents the URL for the Meeting
        ///     Workspace that the appointment item is linked to. Read-only.
        ///</summary>

        public override string MeetingWorkspaceURL { get { return Item.MeetingWorkspaceURL; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the mileage for an item.
        ///     Read/write.
        ///</summary>

        public override string Mileage { get { return Item.Mileage; } set { Item.Mileage = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override bool NetMeetingAutoStart { get { return Item.NetMeetingAutoStart; } set { Item.NetMeetingAutoStart = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override string NetMeetingDocPathName { get { return Item.NetMeetingDocPathName; } set { Item.NetMeetingDocPathName = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override string NetMeetingOrganizerAlias { get { return Item.NetMeetingOrganizerAlias; } set { Item.NetMeetingOrganizerAlias = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override string NetMeetingServer { get { return Item.NetMeetingServer; } set { Item.NetMeetingServer = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override OlNetMeetingType NetMeetingType { get { return Item.NetMeetingType; } set { Item.NetMeetingType = value; } }
        ///<summary>
        ///     This object, member, or enumeration is deprecated and is not intended to
        ///     be used in your code.
        ///</summary>

        public override string NetShowURL { get { return Item.NetShowURL; } set { Item.NetShowURL = value; } }
        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that is True to not age the
        ///     Outlook item. Read/write.
        ///</summary>

        public override bool NoAging { get { return Item.NoAging; } set { Item.NoAging = value; } }
        ///<summary>
        ///     Returns or sets a String (string in C#) representing the display string of
        ///     optional attendees names for the appointment. Read/write.
        ///</summary>

        public override string OptionalAttendees { get { return Item.OptionalAttendees; } set { Item.OptionalAttendees = value; } }
        ///<summary>
        ///     Returns a String (string in C#) representing the name of the organizer of
        ///     the appointment. Read-only.
        ///</summary>

        public override string Organizer { get { return Item.Organizer; } }

        ///<summary>
        ///     Returns an Integer (int in C#) value representing the build number of the
        ///     Outlook application for an Outlook item. Read-only.
        ///</summary>
        public override int OutlookInternalVersion { get { return Item.OutlookInternalVersion; } }

        ///<summary>
        ///     Returns the parent Object of the specified object. Read-only.
        ///</summary>
        public override dynamic Parent { get { return Item.Parent; } }

        ///<summary>
        ///     Returns a Microsoft.Office.Interop.Outlook.PropertyAccessor object that supports
        ///     creating, getting, setting, and deleting properties of the parent Microsoft.Office.Interop.Outlook.AppointmentItem
        ///     object. Read-only.
        ///</summary>
        public override PropertyAccessor PropertyAccessor { get { return Item.PropertyAccessor; } }

        ///<summary>
        ///     Returns a Microsoft.Office.Interop.Outlook.Recipients collection that represents
        ///     all the recipients for the Outlook item. Read-only.
        ///</summary>
        public override Recipients Recipients { get { return Item.Recipients; } }

        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.OlRecurrenceState constant indicating
        ///     the recurrence property of the specified object. Read-only.
        ///</summary>
        public override OlRecurrenceState RecurrenceState { get { return Item.RecurrenceState; } }

        ///<summary>
        ///     Returns or sets an Integer (int in C#) value indicating the number of minutes
        ///     the reminder should occur prior to the start of the appointment. Read/write.
        ///</summary>
        public override int ReminderMinutesBeforeStart { get { return Item.ReminderMinutesBeforeStart; } set { Item.ReminderMinutesBeforeStart = value; } }

        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that is True if the reminder
        ///     overrides the default reminder behavior for the item. Read/write.
        ///</summary>
        public override bool ReminderOverrideDefault { get { return Item.ReminderOverrideDefault; } set { Item.ReminderOverrideDefault = value; } }

        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that is True if the reminder
        ///     should play a sound when it occurs for this item. Read/write.
        ///</summary>
        public override bool ReminderPlaySound { get { return Item.ReminderPlaySound; } set { Item.ReminderPlaySound = value; } }

        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that is True if a reminder has
        ///     been set for this item. Read/write.
        ///</summary>
        public override bool ReminderSet { get { return Item.ReminderSet; } set { Item.ReminderSet = value; } }

        ///<summary>
        ///     Returns or sets a String (string in C#) indicating the path and file name
        ///     of the sound file to play when the reminder occurs for the Outlook item.
        ///     Read/write.
        ///</summary>
        public override string ReminderSoundFile { get { return Item.ReminderSoundFile; } set { Item.ReminderSoundFile = value; } }

        ///<summary>
        ///     Returns or sets a DateTime indicating the reply time for the appointment.
        ///     Read/write.
        ///</summary>
        public override DateTime ReplyTime { get { return Item.ReplyTime; } set { Item.ReplyTime = value; } }

        ///<summary>
        ///     Returns a semicolon-delimited String (string in C#) of required attendee
        ///     names for the meeting appointment. Read/write.
        ///</summary>
        public override string RequiredAttendees { get { return Item.RequiredAttendees; } set { Item.RequiredAttendees = value; } }

        ///<summary>
        ///     Returns a semicolon-delimited String (string in C#) of resource names for
        ///     the meeting. Read/write.
        ///</summary>
        public override string Resources { get { return Item.Resources; } set { Item.Resources = value; } }

        ///<summary>
        ///     Returns a Boolean (bool in C#) that indicates True if the sender would like
        ///     a response to the meeting request for the appointment. Read/write.
        ///</summary>
        public override bool ResponseRequested { get { return Item.ResponseRequested; } set { Item.ResponseRequested = value; } }

        ///<summary>
        ///     Returns an Microsoft.Office.Interop.Outlook.OlResponseStatus constant indicating
        ///     the overall status of the meeting for the current user for the appointment.
        ///     Read-only.
        ///</summary>
        public override OlResponseStatus ResponseStatus { get { return Item.ResponseStatus; } }

        ///<summary>
        ///     Returns or sets a byte array that represents the body of the Microsoft Outlook
        ///     item in Rich Text Format. Read/write.
        ///</summary>
        public override dynamic RTFBody { get { return Item.RTFBody; } set { Item.RTFBody = value; } }

        ///<summary>
        ///     Returns a Boolean (bool in C#) value that is True if the Outlook item has
        ///     not been modified since the last save. Read-only.
        ///</summary>
        public override bool Saved { get { return Item.Saved; } }

        ///<summary>
        ///     Returns or sets an Microsoft.Office.Interop.Outlook.Account object that represents
        ///     the account under which the Microsoft.Office.Interop.Outlook.AppointmentItem
        ///     is to be sent. Read/write.
        ///</summary>
        public override Account SendUsingAccount { get { return Item.SendUsingAccount; } set { Item.SendUsingAccount = value; } }

        ///<summary>
        ///     Returns or sets a constant in the Microsoft.Office.Interop.Outlook.OlSensitivity
        ///     enumeration indicating the sensitivity for the Outlook item. Read/write.
        ///</summary>
        public override OlSensitivity Sensitivity { get { return Item.Sensitivity; } set { Item.Sensitivity = value; } }

        ///<summary>
        ///     Returns the Microsoft.Office.Interop.Outlook.NameSpace object for the current
        ///     session. Read-only.
        ///</summary>
        public override NameSpace Session { get { return Item.Session; } }

        ///<summary>
        ///     Returns or sets a DateTime indicating the starting date and time for the
        ///     Outlook item. Read/write.
        ///</summary>
        public override DateTime Start { get { return Item.Start; } set { Item.Start = value; } }

        ///<summary>
        ///     Returns or sets a DateTime value that represents the start date and time
        ///     of the appointment expressed in the Microsoft.Office.Interop.Outlook._AppointmentItem.StartTimeZone.
        ///     Read/write.
        ///</summary>
        public override DateTime StartInStartTimeZone { get { return Item.StartInStartTimeZone; } set { Item.StartInStartTimeZone = value; } }

        ///<summary>
        ///     Returns or sets a Microsoft.Office.Interop.Outlook.TimeZone value that corresponds
        ///     to the time zone for the start time of the appointment. Read/write.
        ///</summary>
        public override Outlook.TimeZone StartTimeZone { get { return Item.StartTimeZone; } set { Item.StartTimeZone = value; } }

        ///<summary>
        ///     Returns or sets a DateTime value that represents the start date and time
        ///     of the appointment expressed in the Coordinated Univeral Time (UTC) standard.
        ///     Read/write.
        ///</summary>
        public override DateTime StartUTC { get { return Item.StartUTC; } set { Item.StartUTC = value; } }

        ///<summary>
        ///     Returns or sets a Boolean (bool in C#) value that is True if the Outlook
        ///     item has not been opened (read). Read/write.
        ///</summary>
        public override bool UnRead { get { return Item.UnRead; } set { Item.UnRead = value; } }

        ///<summary>
        ///     Returns the Microsoft.Office.Interop.Outlook.UserProperties collection that
        ///     represents all the user properties for the Outlook item. Read-only.
        ///</summary>
        public override UserProperties UserProperties { get { return Item.UserProperties; } }

        ///<summary>
        ///     Removes the recurrence settings and restores the single-occurrence state
        ///     for an appointment or task.
        ///</summary>
        public override void ClearRecurrencePattern() { Item.ClearRecurrencePattern(); }

        ///<summary>
        ///     Closes and optionally saves changes to the Outlook item.
        /// Parameters:
        ///   SaveMode:
        ///     The close behavior. If the item displayed within the inspector has not been
        ///     changed, this argument has no effect.
        ///</summary>
        public override void Close(OlInspectorClose SaveMode) { Item.Close(SaveMode); }

        ///<summary>
        ///     Creates another instance of an object.
        /// Returns:
        ///     Returns an System.Object that is a copy of the parent appointment item.
        ///</summary>
        public override dynamic Copy() { return Item.Copy(); }

        ///<summary>
        ///     Copies the Microsoft.Office.Interop.Outlook.AppointmentItem to the folder
        ///     that is specified by the DestinationFolder parameter and returns an object
        ///     that represents the item created in the destination folder by the copy operation.
        /// Parameters:
        ///   DestinationFolder:
        ///     Specifies the folder to which the AppointmentItem object is copied.
        ///   CopyOptions:
        ///     Specifies the user experience of the copy operation.
        /// Returns:
        ///     Returns an AppointmentItem objectthat represents the object created in the
        ///     destination folder as a result of the copy operation.
        ///</summary>
        public override AppointmentItem CopyTo(MAPIFolder DestinationFolder, OlAppointmentCopyOptions CopyOptions) { return Item.CopyTo(DestinationFolder, CopyOptions); }

        ///<summary>
        ///     Deletes an object from the collection.
        ///</summary>
        public override void Delete() { Item.Delete(); }

        ///<summary>
        ///     Displays a new Microsoft.Office.Interop.Outlook.Inspector object for the
        ///     item.
        /// Parameters:
        ///   Modal:
        ///     True to make the window modal. The default value is False.
        ///</summary>
        public override void Display(object Modal = null) { Item.Display(Modal); }

        ///<summary>
        ///     Forwards the Microsoft.Office.Interop.Outlook.AppointmentItem as a vCal;
        ///     virtual calendar item.
        /// Returns:
        ///     A Microsoft.Office.Interop.Outlook.MailItem object that represents the new
        ///     mail item to which the calendar information is attached.
        ///</summary>
        public override MailItem ForwardAsVcal() { return Item.ForwardAsVcal(); }

        ///<summary>
        ///     Obtains a Microsoft.Office.Interop.Outlook.Conversation object that represents
        ///     the conversation to which this item belongs.
        /// Returns:
        ///     Returns a Conversation object that represents the conversation to which this
        ///     item belongs.
        ///</summary>
        public override Conversation GetConversation() { return Item.GetConversation(); }

        ///<summary>
        ///     Obtains the Microsoft.Office.Interop.Outlook.AddressEntry object that contains
        ///     information from the Address Book about the organizer of the Microsoft.Office.Interop.Outlook.AppointmentItem.
        /// Returns:
        ///     Returns an AddressEntry object that represents the organizer of the AppointmentItem.
        ///</summary>
        public override AddressEntry GetOrganizer() { return Item.GetOrganizer(); }

        ///<summary>
        ///     Returns a Microsoft.Office.Interop.Outlook.RecurrencePattern object that
        ///     represents the recurrence attributes of an appointment.
        /// Returns:
        ///     A RecurrencePattern object that represents the recurrence attributes of an
        ///     appointment.
        ///</summary>
        public override RecurrencePattern GetRecurrencePattern() { return Item.GetRecurrencePattern(); }

        ///<summary>
        ///     Moves a Microsoft Outlook item to a new folder.
        /// Parameters:
        ///   DestFldr:
        ///     The destination folder.
        /// Returns:
        ///     An Object value that represents the item which has been moved to the designated
        ///     folder.
        ///</summary>
        public override dynamic Move(MAPIFolder DestFldr) { return Item.Move(DestFldr); }

        ///<summary>
        ///     Prints the Outlook item using all default settings. The PrintOut method is
        ///     the only Outlook method that can be used for printing.
        ///</summary>
        public override void PrintOut() { Item.PrintOut(); }

        ///<summary>
        ///     Responds to a meeting request.
        /// Parameters:
        ///   Response:
        ///     The response to the request.
        ///   fNoUI:
        ///     True to not display a dialog box; the response is sent automatically. False
        ///     to display the dialog box for responding.
        ///   fAdditionalTextDialog:
        ///     False to not prompt the user for input; the response is displayed in the
        ///     inspector for editing. True to prompt the user to either send or send with
        ///     comments. This argument is valid only if fNoUI is False.
        /// Returns:
        ///     A Microsoft.Office.Interop.Outlook.MeetingItem object that represents the
        ///     response to the meeting request.
        ///</summary>
        public override MeetingItem Respond(OlMeetingResponse Response, object fNoUI = null, object fAdditionalTextDialog = null) { return Item.Respond(Response, fNoUI, fAdditionalTextDialog); }

        ///<summary>
        ///     Saves the Microsoft Outlook item to the current folder or, if this is a new
        ///     item, to the Outlook default folder for the item type.
        ///</summary>
        public override void Save() { Item.Save(); }

        ///<summary>
        ///     Saves the Microsoft Outlook item to the specified path and in the format
        ///     of the specified file type. If the file type is not specified, the MSG format
        ///     (.msg) is used.
        /// Parameters:
        ///   Path:
        ///     The path in which to save the item.
        ///   Type:
        ///     The file type to save. Can be one of the following OlSaveAsType constants:
        ///     olHTML, olMSG, olRTF, olTemplate, olDoc,olTXT, olVCal, olVCard, olICal, or
        ///     olMSGUnicode.
        ///</summary>
        public override void SaveAs(string Path, object Type = null) { Item.SaveAs(Path, Type); }

        ///<summary>
        ///     Sends the appointment.
        ///</summary>
        public override void Send() { ((Outlook._AppointmentItem)Item).Send(); }

        ///<summary>
        ///     Displays the Show Categories dialog box, which allows you to select categories
        ///     that correspond to the subject of the item.
        ///</summary>
        public override void ShowCategoriesDialog() { Item.ShowCategoriesDialog(); }

        #endregion

        /// <summary>
        /// Disposes the Outlook Mail item object
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Dispose managed resources
            }

            UnRegisterEvents();

            // Dispose unmanaged resources
            base.Dispose(disposing);

            Marshal.ReleaseComObject(Item);
            Item = null;
        }

        #region events
        public override event ItemEvents_10_AfterWriteEventHandler AfterWrite;
        public override event ItemEvents_10_AttachmentAddEventHandler AttachmentAdd;
        public override event ItemEvents_10_AttachmentReadEventHandler AttachmentRead;
        public override event ItemEvents_10_AttachmentRemoveEventHandler AttachmentRemove;
        public override event ItemEvents_10_BeforeAttachmentAddEventHandler BeforeAttachmentAdd;
        public override event ItemEvents_10_BeforeAttachmentPreviewEventHandler BeforeAttachmentPreview;
        public override event ItemEvents_10_BeforeAttachmentReadEventHandler BeforeAttachmentRead;
        public override event ItemEvents_10_BeforeAttachmentSaveEventHandler BeforeAttachmentSave;
        public override event ItemEvents_10_BeforeAttachmentWriteToTempFileEventHandler BeforeAttachmentWriteToTempFile;
        public override event ItemEvents_10_BeforeAutoSaveEventHandler BeforeAutoSave;
        public override event ItemEvents_10_BeforeCheckNamesEventHandler BeforeCheckNames;
        public override event ItemEvents_10_BeforeDeleteEventHandler BeforeDelete;
        public override event ItemEvents_10_BeforeReadEventHandler BeforeRead;
        public override event ItemEvents_10_CustomActionEventHandler CustomAction;
        public override event ItemEvents_10_ForwardEventHandler ForwardItem;
        public override event ItemEvents_10_CustomPropertyChangeEventHandler CustomPropertyChange;
        public override event ItemEvents_10_OpenEventHandler Open;
        public override event ItemEvents_10_PropertyChangeEventHandler PropertyChange;
        public override event ItemEvents_10_ReadEventHandler Read;
        public override event ItemEvents_10_ReplyAllEventHandler ReplyAllItem;
        public override event ItemEvents_10_ReplyEventHandler ReplyItem;
        public override event ItemEvents_10_UnloadEventHandler Unload;
        public override event ItemEvents_10_WriteEventHandler Write;
        #endregion
    }
}
